package com.rfid.uhf288;


import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

public class JsonResult {
    // 成功状态
    public static final Integer SUCCESS_CODE = 200;
    // 错误
    public static final Integer ERROR_CODE = 500;


    public static final <T> JSONObject success(Object data) {
        JSONObject jsonObject = new JSONObject();

        jsonObject.put("data", data);
        jsonObject.put("code", SUCCESS_CODE);

        return jsonObject;
    }

    public static final JSONObject fail(String message) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("message", message);
        jsonObject.put("code", ERROR_CODE);

        return jsonObject;
    }
}